package com.example.demo.service;

import com.example.demo.dao.ArticleMapper;
import com.example.demo.model.ArticleInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/* @Author      zouzh
 * @PackageName BlogSystem-sm
 * @Package     com.example.demo.model
 * @Date        2023/9/5 13:48
 */

@Service
public class ArticleService {
    @Autowired
    private ArticleMapper articleMapper;

    public List<ArticleInfo> getListByUid(int uid){
        return articleMapper.getListByUid(uid);
    }

    public int delByAid(Integer aid, int uid){
        return articleMapper.delByAid(aid, uid);
    }

    public int add(ArticleInfo articleInfo){
        return articleMapper.add(articleInfo);
    }

    public ArticleInfo getArticleByIdAndUid(int id,int uid){
        return articleMapper.getArticleByIdAndUid(id, uid);
    }

    public int update(ArticleInfo articleInfo){
        return articleMapper.update(articleInfo);
    }

    public ArticleInfo getDetailById(int aid){
        return articleMapper.getDetailById(aid);
    }

    public int getArtCountByUid(int uid){
        return articleMapper.getArtCountByUid(uid);
    }

    public int updateRCount(int aid){
        return articleMapper.updateRCount(aid);
    }

    public List<ArticleInfo> getListByPage(int psize, int offset){
        return articleMapper.getListByPage(psize, offset);
    }

    public int getCount(){
       return articleMapper.getCount();
    }

}
